Re: chroot'ed environment?

don@paranoia.com
Thu, 20 Apr 1995 03:32:16 -0500 (CDT)

> Excerpted from 'man 3 openlog' on an AIX 3.2.5 system, but it should be
> in any BSD4.3 system:
> 
>   #include <syslog.h>
>   
>   int openlog (ID, LogOption, Facility)
>   char *ID;
>   int LogOption, Facility;
> ...
>   LogOption     Specifies a bit field that indicates logging options.
>   The values of LogOption are:
> ...
>   LOG_NDELAY    Opens the connection to the syslogd command immediate-
>   ly, instead of when the first  message is logged.  This option is
>   useful for  programs  that need to manage the order in which file
>   descriptors are allocated.
> ...
> 
> So if you call  openlog(argv[0],LOG_NDELAY,LOG_DAEMON);  the LOG_NDELAY
> will open /dev/log *now* (presumably before you chroot()).  And as we all
> know, open file descriptors are not affected by a chroot()....
> 
> 				Valdis Kletnieks
> 				Computer Systems Engineer
> 				Virginia Tech

Come to think of it, 'sfingerd' (ftp://hplyot.obspm.fr/net/sfingerd*.tar.gz)
uses this technique, and has been running here at paranoia.com for a while
now, I believe.  Works quite well.


Michael E. Glasgow     --     don@paranoia.com
                              http://www.paranoia.com